#include "cute_lib/cute.h"

#include "predictor_target.h"
#include "predictor_const_v.h"
#include "predictor_link.h"
#include "arena_1dfood.h"
#include "machine.h"
#include "machine_factory.h"
#include "model.h"
#include "model_link.h"

void Model_test( void )
{
  Predictor_base *p = new Predictor_target( "TEST" );

  Model *m1 = new Model( p );
  Model *m2 = new Model( p );

  m1->set_string_id( "Model 1" );

  ASSERT_EQUAL( false, m1->is_active() );
  ASSERT_EQUAL( false, m2->is_active() );

  m1->add_inhibitor_link( m2 );

  m2->activate( 10.0 );
  ASSERT_EQUAL( true, m2->is_active() );

  m2->activate_output_link();
  ASSERT_EQUAL( true, m2->get_output_link()->is_active() );

  m1->activate( 10.0 );
  ASSERT_EQUAL( true, m1->is_active() );

  // the output link of m1 must now be inactive since m2 is inhibitor
  m1->activate_output_link();
  ASSERT_EQUAL( false, m1->get_output_link()->is_active() );
}
